import { IEntityDetail } from '../common';
import { IContext } from '../common/i-context';
import { IParam } from '../common/i-param';
import { IProjectSetting } from './i-project-setting';
import {
	IAppCodeListHelper,
	IAppFunc,
	IAppFuncHelper,
	IGlobalActionHelper,
	IDialogHelper,
	INotificationHelper,
	IOpenViewHelper,
	IViewLogicHelper,
	ILoadingHelper,
	IAppViewMsgHelper,
	IAppCounterHelper,
	IGlobalNotificationHelper,
	IDevActionHelper,
    ICustomDialogOptions,
} from '../modules';
import { IAppData } from './i-app-data';
import { IAppConfig } from '..';

export interface IApp {
	/**
	 * 获取应用功能辅助类
	 *
	 */
	getAppFuncHelper(): IAppFuncHelper;

	/**
	 * 获取打开视图辅助类
	 *
	 */
	getOpenViewHelper(): IOpenViewHelper;

	/**
	 * 获取应用代码表辅助类
	 *
	 */
	getAppCodeListHelper(): IAppCodeListHelper;

	/**
	 * 获取应用视图消息辅助类
	 *
	 */
	getAppViewMsgHelper(): IAppViewMsgHelper;

	/**
	 * 获取计数器辅助类
	 */
	getAppCounterHelper(): IAppCounterHelper;

	/**
	 * 获取应用加载辅助类
	 *
	 * @return {*}  {ILoadingHelper}
	 * @memberof IApp
	 */
	getAppLoadingHelper(): ILoadingHelper;

	/**
	 * 消息提示辅助类
	 */
	getNotificationHelper(): INotificationHelper;

	/**
	 * 对话框提示辅助类
	 */
	getDialogHelper(): IDialogHelper;

	/**
	 * 获取全局行为辅助类
	 *
	 * @return {*}  {IGlobalActionHelper}
	 * @memberof IApp
	 */
	getGlobalActionHelper(): IGlobalActionHelper;

	/**
	 * 获取debug 控制器辅助类
	 *
	 * @return {*}  {IDevActionHelper}
	 * @memberof App
	 */
	getDevActionHelper(): IDevActionHelper;

	/**
	 * 获取视图逻辑辅助类
	 *
	 * @return {*}  {IViewLogicHelper}
	 * @memberof IApp
	 */
	getViewLogicHelper(): IViewLogicHelper;

	/**
	 * 获取全局通知
	 *
	 * @return {*}  {IGlobalNotificationHelper}
	 * @memberof IApp
	 */
	getGlobalNotificationHelper(): IGlobalNotificationHelper;

	/**
	 * 获取数据服务
	 *
	 * @param name
	 * @param context
	 */
	getDataService(name: string, context?: IContext): Promise<any>;

	/**
	 * 获取界面服务
	 *
	 * @param {string} name
	 * @param {IContext} [context]
	 * @return {*}  {Promise<any>}
	 * @memberof IApp
	 */
	getUIService(name: string, context?: IContext): Promise<any>;

	/**
	 * 设置界面应用对象
	 * @param UIApp
	 */
	setUIAppInstance(UIApp: IParam): void;

	/**
	 * 获取界面应用对象
	 */
	getUIAppInstance(): IParam | undefined;

	/**
	 * 获取应用功能配置
	 *
	 * @return {*}  {IAppFunc[]}
	 * @memberof IApp
	 */
	getAppFuncConfig(): IAppFunc[];

	/**
	 * 获取应用视图配置
	 *
	 * @return {*}  {IParam}
	 * @memberof IApp
	 */
	getAppViewConfig(): IParam;

	/**
	 * 获取应用主题配置
	 *
	 * @return {*}  {IParam}
	 * @memberof IApp
	 */
	getAppThemeConfig(): IParam[];

	/**
	 * 获取项目设置
	 *
	 * @return {*}  {IProjectSetting}
	 * @memberof IApp
	 */
	getProjectSetting(): IProjectSetting;

	/**
	 * 获取代码表配置
	 *
	 * @return {*}  {IParam}
	 * @memberof IApp
	 */
	getAppCodeListConfig(): IParam;

	/**
	 * 获取计数器配置参数
	 *
	 * @return {*}  {IParam}
	 * @memberof IApp
	 */
	getAppCounterConfig(): IParam;

	/**
	 * 获取视图消息配置
	 *
	 * @return {*}  {IParam}
	 * @memberof IApp
	 */
	getAppViewMsgConfig(): IParam;

	/**
	 * 获取应用实体配置
	 *
	 * @return {*}  {IEntityDetail[]}
	 * @memberof IApp
	 */
	getAppEntityConfig(): IEntityDetail[];

	/**
	 * 获取应用配置
	 *
	 * @return {*}  {IAppConfig}
	 * @memberof IApp
	 */
	getAppConfig(): IAppConfig;

	/**
	 * 获取应用数据
	 */
	getAppData(): IAppData;

	/**
	 * 清除应用数据
	 */
	clearAppData(): boolean;

	/**
	 * 获取应用是否启用权限
	 */
	getEnableAppPermission(): boolean;

	/**
	 * 获取指定菜单是否存在权限
	 * @param tag 菜单权限标识
	 */
	getAppMenuAuth(tag: string): boolean;

	/**
	 * 获取指定统一资源是否存在权限
	 * @param tag 统一资源标识
	 */
	getAppUniresAuth(tag: string): boolean;

	/**
	 * 用户登录
	 */
	login(loginname?: string, password?: string): void;

	/**
	 * 用户登出
	 */
	logout(): Promise<IParam>;

	/**
	 * 关于系统
	 */
	aboutSystem(): void;

	/**
	 * 翻译
	 * @param resTag  语言标识
	 * @param str 源字符
	 */
	ts(resTag: string, str?: string): string;

	/**
	 * 关闭应用页面
	 *
	 * @memberof IApp
	 */
	closeView(): void;

	/**
	 * 关闭应用loadding
	 *
	 * @memberof IApp
	 */
	closeAppLoadding(): void;

    /**
     * 获取视图关闭提示
     *
     * @param {string} tag 视图标识
     * @return {*}  {ICustomDialogOptions}
     * @memberof IApp
     */
    getViewCloseHint(tag: string): ICustomDialogOptions;

	/**
	 * 启动微应用
	 * @memberof IApp
	 */
	startMicroApp(): any;

	/**
	 * 通知基座应用
	 * @param action 
	 * @param data 
	 * @memberof IApp
	 */
	noticeBaseApp(action:string,data:any):void;

	/**
	 * 获取当前应用是否在微应用环境
	 *
	 * @return {*}  {boolean}
	 * @memberof IApp
	 */
	getIsMicroApp():boolean;

	/**
	 * 获取微应用全局状态
	 * @returns
	 * @memberof IApp
	 */
	getGlobalState():void;
}
